/**
 * Project:   warnme-app
 * File:      RestClientHolder.java
 * License: 
 *            This file is licensed under GNU General Public License version 3
 *            http://www.gnu.org/licenses/gpl-3.0.txt
 *
 * Copyright: Bartosz Cichecki [ cichecki.bartosz@gmail.com ]
 * Date:      Mar 27, 2014
 */

package dtu.ds.warnme.app.ws.client.restful;

import android.util.Log;
import dtu.ds.warnme.app.application.Prefs;

/**
 * @author Bartosz Cichecki
 * 
 */
public class RestClientHolder {

	private static final String TAG = "RestClientHolder";

	private static RestClient restClient;

	public static RestClient getRestClient() {
		if (restClient == null) {
			updateRestClient();
		}
		return restClient;
	}

	public static void updateRestClient() {
		Log.d(TAG, "Refreshing RestClient");
		restClient = new RestClient(Prefs.getHost(), Prefs.getPort(), Prefs.getWsContextPath(), Prefs.getUsername(),
		        Prefs.getPasswordHash(), Prefs.getRealm());
	}

}
